<template>
	<view class="advice-page">
		<cu-custom bgColor="bg-gradual-blue" :isBack="true">
			<block slot="content">医生建议</block>
		</cu-custom>

		<view class="advice-list">
			<view class="advice-item" v-for="(item, index) in adviceList" :key="index">
				<view class="advice-title">{{ item.title }}</view>
				<view class="advice-content">{{ item.content }}</view>
			</view>
		</view>
	</view>
</template>

<script>
	import request from '@/common/request.js';
	export default {
		data() {
			return {
				adviceList: []
			};
		},
		onLoad() {
			this.getData();
		},
		methods: {
			getData() {
				let opts = {
					url: '/json/advice.json', // 修改为通过代理访问医生建议数据
					method: 'get'
				};
				uni.showLoading({
					title: '加载中'
				});
				request.httpRequest(opts).then(res => {
					console.log(res);
					uni.hideLoading();
					if (res.statusCode == 200) {
						this.adviceList = res.data.data;
					} else {
						uni.showToast({
							title: '加载失败',
							icon: 'none'
						});
					}
				});
			}
		}
	};
</script>

<style lang="scss" scoped>
	.advice-page {
		background-color: #f5f5f5;
		min-height: 100vh;
	}

	.advice-list {
		padding: 20rpx;
	}

	.advice-item {
		background-color: #fff;
		border-radius: 10rpx;
		margin-bottom: 20rpx;
		padding: 20rpx;
		box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
	}

	.advice-title {
		font-size: 32rpx;
		font-weight: bold;
		color: #333;
		margin-bottom: 10rpx;
	}

	.advice-content {
		font-size: 28rpx;
		color: #666;
		line-height: 1.6;
	}
</style>
